package diadraw.sharing.dropbox
{
	/**
	 * @author Radoslava Leseva, Radoslava.Leseva@diadraw.com
	 * http://diadraw.com
	 * http://ideadrawapp.com
	 * 
	 * */
	
	import mx.collections.ArrayList;

	public class DropboxObject
	{
		public function DropboxObject( _name : String, _path : String = null )
		{
			m_name = _name;
			m_path = _path;
			
			m_icon = FOLDER_ICON;
		}
		
		
		public function set iconFile( _icon : Class ) : void
		{
			m_icon = _icon;
		}
		
		
		public function get iconFile() : Class
		{
			return m_icon;
		}
		
		
		public function get folderName() : String
		{
			return m_name;
		}
		
		
		public function get name() : String
		{
			return m_name;
		}
		
		
		public function set name( _name : String ) : void
		{
			m_name = _name;
		}
		
		
		public function get path() : String
		{
			return m_path;
		}
		
		
		public function set path( _path : String ) : void
		{
			m_path = _path;
		}
		
		
		public function toString() : String
		{
			return m_name;
		}
		
		
		public function get hasChildren() : Boolean
		{
			if ( null == m_objList )
			{
				return false;
			}
			
			return 0 < m_objList.length;
		}
		
		
		public function get children() : ArrayList
		{
			return m_objList;
		}
		
		
		public function addChild( _child : DropboxObject ) : void
		{
			// assert child
			
			if ( null == m_objList )
			{
				m_objList = new ArrayList();
			}
			
			m_objList.addItem( _child );
		}
		
		
		private var m_name : String;
		private var m_path : String;
		
		[Embed(source="assets/iconFolder.png")]
		private const FOLDER_ICON : Class;
		
		private var m_icon : Class;

		private var m_objList : ArrayList = null;
	}
}